package com.lagou.homework.modulefour.third;

/*
 * @className ConsumerThread
 * @description
 * @author admin
 * @date 2022/4/1 16:23
 * */
public class ConsumerThread extends Thread{

    private Train train;

    // 无参构造
    public ConsumerThread(){}

    // 有参构造
    public ConsumerThread(Train train){
        this.train = train;
    }

    @Override
    public void run() {
        while(true) {
            train.consumerTrainTicket();
            try {
                Thread.sleep(300);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
